package org.corey.dev.voxiverse.universe;

import org.corey.dev.voxiverse.body.Body;
import org.corey.dev.voxiverse.Game;
import org.corey.dev.voxiverse.Player;
import org.lwjgl.opengl.GL11;

public class Universe {
	static final int UNIVERSE_SIZE = 1;
	
	private Body[] bodies;
	
	public void Render(){
		//this will point to World.Render() for each planet
		for (int i = 0; i < UNIVERSE_SIZE; i++){
			bodies[i].Render();
		}
	}
	
	public void Update(){
		GL11.glRotatef(Game.player.pitch, -1.0f, 0.0f, 0f); //need to finetune these
		GL11.glRotatef(Game.player.yaw, 0.0f, 1.0f, 0.0f);
		GL11.glTranslatef(Game.player.position.x, Game.player.position.y, Game.player.position.z);
		
		for (int i = 0; i < UNIVERSE_SIZE; i++){
			bodies[i].Update();
		}
		Player.Update();
		
		//this is where every single update that needs to be made to the game will go
	}
	
	public Universe(){
		//this will create each world pointing to new body() with number of body and random coords
		
		bodies = new Body[UNIVERSE_SIZE];
		
		System.out.println("Populating Universe...");
		for (int i = 0; i < UNIVERSE_SIZE; i++){
			bodies[i] = new Body();
		}
	}
}
